<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddReferences extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
//        Schema::table('base_replies',function (Blueprint $table){
//            $table->foreign('spot_id')->references('id')->on('spots')->onDelete('cascade');
//            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
//        });
//        Schema::table('base_pictures',function (Blueprint $table){
//            $table->foreign('spot_id')->references('id')->on('spots')->onDelete('cascade');
//            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
//        });

//        Schema::table('base_pictures',function (Blueprint $table){
//            $table->foreign('spot_id')->references('id')->on('spots')->onDelete('cascade');
//            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
//        });
//
//        Schema::table('topics',function (Blueprint $table){
//            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
//        });
//        Schema::table('replies',function (Blueprint $table){
//            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
//            // 当 topic_id 对应的 topics 表数据被删除时，删除此条数据
//            $table->foreign('topic_id')->references('id')->on('topics')->onDelete('cascade');
//        });
//
//
//        Schema::table('travels',function (Blueprint $table){
//            // 当 user_id 对应的 users 表数据被删除时，删除词条
//            $table->foreign('uid')->references('id')->on('users')->onDelete('cascade');
//        });
//        Schema::table('travels_replies',function (Blueprint $table){
//            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
//            $table->foreign('travels_id')->references('id')->on('travels')->onDelete('cascade');
//        });




    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
//        Schema::table('base_pictures', function (Blueprint $table) {
//            // 移除外键约束
//            $table->dropForeign(['spot_id']);
//        });
//        Schema::table('base_replies', function (Blueprint $table) {
//            // 移除外键约束
//            $table->dropForeign(['spot_id']);
//        });

    }
}
